<template>
  <div class="achievement" id="nav-bar">
    <van-nav-bar title="更多成绩单" left-arrow @click-left="$router.go(-1)" />
    <van-search v-model="keyWord" @search="refreshList" @clear="refreshList" placeholder="请输入搜索关键词" />

    <van-cell-group class="achievementList">
      <van-cell
        class="van_Cell"
        v-for="(item, index) of dataList"
        :key="index"
        :title="item.printType"
        is-link
        :icon="icon"
        @click="viewFile(item)"
      />
    </van-cell-group>
  </div>
</template>
<script>
export default {
  data() {
    return {
      icon: require("@/assets/images/iconpng/icon/cjd.png"),
      dataList: [],
      printType: "",
      fileProperty: 0,
      keyWord:'',
    };
  },
  created() {
    const { fileProperty } = this.$route.query;
    this.fileProperty = fileProperty;
    this.refreshList();
  },
  methods: {
    // 查看文件
    viewFile(item) {
      this.$store.commit(`app/${this.$types.SET_CURRENT_FILE}`, item);
      this.$store.commit(`app/${this.$types.SET_CACHE_ROUTES}`,'previewFile');
      this.$router.push(
        `/pageList/preview?vcid=${item.vcPrintTypeId}&fileProperty=${this.fileProperty}`
      );
    },
    //获取数据
    refreshList() {
      this.$toast.loading({
        message: "加载中...",
        mask: true,
      });
      this.$http({
        url: "/private-xm/electronicDocument/printType",
        method: "post",
        data: {
          fileProperty: this.fileProperty,
          printType: this.printType,
          printType:this.keyWord,
        },
      })
        .then((res) => {
          this.$toast.clear();
          this.dataList = res.data;
        })
        .catch((error) => {
          this.$toast.clear();
          console.log(error, "error");
          this.$toast(error);
        });
    },
  },
};
</script>
<style lang="scss" scoped>
#nav-bar ::v-deep .van-nav-bar__title{
		color: #fff;
    font-size: .506667rem /* 19/37.5 */;
  }
.achievement {
  position: relative;
  .van_Cell{
    padding:.533333rem /* 20/37.5 */;
  }
}
</style>
